<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>4_1_3-2-捕获事件</title>
</head>

<body>


  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <div id="app">
    <div @click.capture="click1" style="border: solid red">
      外层
      <div @click.capture="click2" style="border: solid red">
        中层
        <div @click.capture="click3" style="border: solid red">点击</div>
      </div>
    </div>
  </div>

  <script>
    //定义一个Vue组件，名为App
    const App = {
      //定义组件中的数据
      data() {
        return {
          count: 0,
        };
      },

      //定义计算属性
      computed: {},

      //定义组件中的函数
      methods: {
        click(step) {
          this.count += step;
        },
        log(event) {
          console.log(event);
        },
        click1() {
          console.log("外层");
        },
        click2() {
          console.log("中层");
        },
        click3() {
          console.log("内层");
        },
      },
    };
    Vue.createApp(App).mount("#app");
  </script>
</body>

</html>